{% extends "base.html" %}
{% load i18n %}
{% block title %}
{% if post.blog %}
{{ post.blog }}
{% else %}
{{ post.author }}
{% endif %}
 — {{ post.title }}
{% endblock %}
{% block keywords %}
    {% for tag in post.get_tags %}
        {{ tag }}{% if not forloop.last %}, {% endif %}
    {% endfor %}
{% endblock %}
{% block content %}
{% include 'post_item.html' %}
{% load tagging_tags %}
<br />
<hr />
<div class="single_post_bottom">
    <div class="post_full">
    <span class='grey'>{% trans 'Tags:' %}</span>
        {% for tag in post.get_tags %}
            <a href='/tag/{{ tag }}/'>{{ tag }}</a>
        {% endfor %}
    </div>
{% include "post_rate.html" %}
</div>
<div class='post_actions'>
{% if request.user.is_authenticated %}

        {% if PERM_EDIT_POST %}
            <a href='/action/edit_post/{{ post.id }}/'><img src='/media/style/pen.gif' /> {% trans "Edit post!" %}</a>
        {% endif %}
        {% if PERM_DELETE_POST %}
            <a href='/action/delete_post/{{ post.id }}/' id='delete_post'><img src='/media/style/trash.gif' /> {% trans "Delete post!" %}</a>
            <a href='/action/post_options/{{ post.id }}/' id='post_options'><img src='/media/style/pound.gif' /> {% trans "Post options" %}</a>
        {% endif %}
        {% if options.favourite %}
            <a href='/action/favourite/{{ post.id }}/' style='margin-right:0'><img src='/media/style/fav.gif' /></a> <a href='/action/favourite/{{ post.id }}/' id='remove_favourite'>{% trans "Remove from favourite!" %}</a>
        {% else %}
            <a href='/action/favourite/{{ post.id }}/' style='margin-right:0'><img src='/media/style/fav.gif' /></a> <a href='/action/favourite/{{ post.id }}/' id='add_favourite'>{% trans "Add to favourite!" %}</a>
        {% endif %}
        {% if post.author != request.user %}
            {% if options.spy %}
                <a href='/action/spy/{{ post.id }}/' style='margin-right:0'><img src='/media/style/eye.gif' /></a> <a href='/action/spy/{{ post.id }}/' id="remove_spy">{% trans "Remove from spy!" %}</a>
            {% else %}
                <a href='/action/spy/{{ post.id }}/' style='margin-right:0'><img src='/media/style/eye.gif' /></a> <a href='/action/spy/{{ post.id }}/' id="add_spy">{% trans "Add to spy!" %}</a>
            {% endif %}
        {% else %}
            {% if is_qa %}
                <a href="/action/mark_solved/{{ post.id }}/{% if post.solved %}0{% else %}1{% endif %}/">
                    <img src='/media/style/pound.gif' /> 
                    {% if post.solved %}
                        {% trans 'Unmark solved' %}
                    {% else %}
                        {% trans 'Mark solved' %}
                    {% endif %}
                </a> 
            {% endif %}
        {% endif %}

{% endif %}
    <a href='/like/{{ post.id }}/'><img src='/media/style/mag_glass.gif' /> {% trans "Related" %}</a>
    <a href='#' id='share_opener'><img src='/media/style/speech_bubble.gif' />{% trans 'Share' %}</a>
    <span id='share_buttons'>
        <script type="text/javascript" src="//yandex.st/share/share.js" charset="utf-8"></script>
        <div class="yashare-auto-init" data-yashareL10n="ru" data-yashareType="none" data-yashareQuickServices="yaru,vkontakte,facebook,twitter,lj"></div>
        <script type="text/javascript" src="https://apis.google.com/js/plusone.js">
          {lang: 'ru'}
        </script>
        <g:plusone size="small" count="false"></g:plusone>
    </span>
</div>
<hr />
<a id='comment'></a>
{% for comment in comments %}
     {% include 'single_comment.html' %}
{% endfor %}
{% if request.user.is_authenticated and not post.disable_reply %}
<div class="comment_reply_form" id='main_form'>
    <form action="/newcomment/" method="POST">
        {{ comment_form.text }}
        {{ comment_form.comment }}
        {{ comment_form.post }}<br />
        <input type="submit" value="{% trans 'Reply' %}" /> <input type='button' class='preview_comment_button' value="{% trans 'Preview' %}" />
    </form>
</div>
<a href='#main_form' id="main_form_hide">{% trans "Reply to post" %}</a>
<div id="update_button_holder"><img id='update_button' style="cursor:pointer" src="/media/style/refr.gif"><br /><a id='updated_count'>—</a></div>
{% endif %}
{% endblock %}
